Ranging method

ABSTRACT

A ranging method is performed using a terminal device including a processor and a ranging chip. The processor having a security region, and the security region is communicatively connected to the ranging chip. The ranging method includes: acquiring a session parameter generated from an initial communication between the terminal device and a device to be ranged; generating, in the security region, a ranging security parameter according to the session parameter; sending the ranging security parameter to the ranging chip via a communication channel between the security region and the ranging chip; and generating, by the ranging chip, a ranging time parameter according to the ranging security parameter, and performing, by the ranging chip, a ranging communication with the device to be ranged using the ranging time parameter to acquire a ranging result.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims the benefit of priority to ChineseApplication No. 202210152371.6, filed on Feb. 18, 2022, the contents ofwhich are incorporated herein by reference in their entireties for allpurposes.

FIELD

The present disclosure generally relates to a terminal device fieldtechnology, and more particularly to a ranging method, a rangingapparatus, an electronic device and a storage medium.

BACKGROUND

Wireless carrier communication technology, such as an ultra-wide band(UWB) technology is applied to common terminal devices such as smartphones and wearable devices, and is widely used in ranging andpositioning, for example in scenarios such as location sensing,non-inductive (or insensitive) payment, non-inductive entrance forexample passing through a subway brake without feeling any trouble, andnon-inductive unlock. The above scenarios using ranging and positioningtechnology have a high requirement for security. However, a securityaccident such as parameter leakage easily happens during generation ofparameters for ranging and positioning for the terminal device, and thesecurity in these scenarios cannot be guaranteed, resulting in threatsto user's information and property safeties.

SUMMARY

In a first aspect of embodiments of the present disclosure, a rangingmethod is provided. The ranging method is performed using a terminaldevice including a processor and a ranging chip, the processor has asecurity region, and the security region is communicatively connected tothe ranging chip. The ranging method includes: acquiring a sessionparameter generated from an initial communication between the terminaldevice and a device to be ranged; generating, in the security region, aranging security parameter according to the session parameter; sendingthe ranging security parameter to the ranging chip via a communicationchannel between the security region and the ranging chip; andgenerating, by the ranging chip, a ranging time parameter according tothe ranging security parameter, and performing, by the ranging chip, aranging communication with the device to be ranged using the rangingtime parameter to acquire a ranging result.

In a second aspect of embodiments of the present disclosure, a rangingmethod is provided. The ranging method is performed using a device to beranged, and includes: acquiring a session parameter generated from aninitial communication between the device to be ranged and a terminaldevice; generating a ranging security parameter according to the sessionparameter; and generating a ranging time parameter according to theranging security parameter, and performing a ranging communication withthe terminal device using the ranging time parameter to acquire aranging result.

In a third aspect of embodiments of the present disclosure, anelectronic device is provided, including: a processor; and a memoryhaving stored therein computer instructions executable by the processor.In case that the computer instructions are executed by the processor,the processor is configured to implement the ranging method as describedin the first or second aspect.

In a fourth aspect of embodiments of the present disclosure, anon-transitory computer-readable storage medium is provided. Thenon-transitory computer-readable storage medium has stored therein acomputer program that, when executed by a processor, causes theprocessor to implement the ranging method as described in the first orsecond aspect.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this specification, illustrate embodiments consistent with thepresent disclosure and, together with the description, serve to explainthe principles of the present disclosure.

FIG. 1 a flow chart of a ranging method applied in a terminal deviceaccording to an embodiment of the present disclosure.

FIG. 2 is a block diagram of a terminal device according to anembodiment of the present disclosure.

FIG. 3 a flow chart of a ranging method applied in a device to be rangedaccording to an embodiment of the present disclosure.

FIG. 4 is a block diagram of a ranging apparatus applied in a terminaldevice according to an embodiment of the present disclosure.

FIG. 5 is a block diagram of a ranging apparatus applied in a device tobe ranged according to an embodiment of the present disclosure.

FIG. 6 is a block diagram of an electronic device according to anembodiment of the present disclosure.

DETAILED DESCRIPTION

Reference will now be made in detail to embodiments, examples of whichare illustrated in the accompanying drawings. The following descriptionrefers to the accompanying drawings in which the same numbers indifferent drawings represent the same or similar elements unlessotherwise represented. The implementations set forth in the followingdescription of the embodiments do not represent all implementationsconsistent with the present disclosure. Instead, they are merelyexamples of apparatuses and methods consistent with aspects related tothe present disclosure as recited in the appended claims.

The terms used in the present disclosure are only for the purpose ofdescribing specific embodiments, and are not intended to limit thepresent disclosure. An item expressed in a singular form such as “a”“an” “the” and “said” in the present disclosure and the appended claimsmay also refer to the majority forms of the items, unless the contextclearly indicates other meanings. It should also be understood thatitems described with the term “and/or” herein refer to any one of thelisted items or all possible combinations of the listed items.

It should be understood that although the terms first, second, third andthe like may be used to describe various information in the presentdisclosure, such information should not be limited to these terms. Theseterms are only used to distinguish the same type of information fromeach other. For example, without departing from the scope of the presentdisclosure, the first information may be called the second information,and similarly, the second information may be called the firstinformation. Depending on the context, the word “if” as used herein canbe interpreted as “when” or “in case that” or “in response todetermining”.

In the first aspect, the present disclosure provides in embodiments aranging method. As shown in FIG. 1 , the method includes operations inblocks S101-S104.

The ranging method can be performed using a terminal device as shown inFIG. 2 . The terminal device includes a processor 201 and a ranging chip202, and the processor has a security region 2011, such as a trustedexecution environment (TEE). The security region 2011 of the processor201 can be communicatively connected to the ranging chip 202. That is,they meet communication conditions on the hardware, for example, SPI orI2C bus and other communication buses can be used to realize thecommunication connection between them. Optionally, the terminal deviceis installed with a software for ranging, which is used to specificallyimplement the ranging method. The ranging method can be realized by theUWB technology or other ranging technologies. If the UWB technology isapplied, the ranging chip can be a UWB chip. The following operationswill give a detailed description of the ranging method by taking the UWBtechnology as an example.

The ranging method is used to detect a distance between the terminaldevice executing the ranging method and a device to be ranged. In someembodiments, the terminal device may be a smart phone, a tabletcomputer, a wearable device, etc., and the device to be ranged may be avehicle, or a door lock of a house. For example, the terminal device canstart the vehicle or unlock the door lock of the house through theranging method, and thus the terminal device can be used as a digitalkey.

In block S101, a session parameter generated from an initialcommunication between the terminal device and a device to be ranged isacquired.

The initial communication between the terminal device and the device tobe ranged is an identification process for the two devices beforeranging. The terminal device can use the software (e.g., a UWB keyservice, hereinafter referred to as a ranging software “UKS”) thatimplements the ranging method to perform the initial communication in aregion other than the security region of the processor. In anembodiment, the security region of the processor is the TEE, and theregion other than the security region of the processor is a richexecution environment (REE). The ranging software UKS has a trustedapplication (TA) part (hereinafter referred to as UKS TA) running in thesecurity region TEE and a client application (CA) part (hereinafterreferred to as UKS CA) set in the other region REE outside the securityregion. In this embodiment, the initial communication can be performedby the UKS CA. The session parameter can be a session key.

For example, the process of the initial communication between theterminal device and the device to be ranged includes the followingoperations. First, the terminal device communicates with the device tobe ranged, to allow the terminal device and the device to be ranged toverify identities of each other, that is, during the communicationprocess, the terminal device verifies whether the device to be ranged isa pairing device, and the device to be ranged verifies whether theterminal device is a pairing device. When the identities of the terminaldevice and the device to be ranged are verified by each other (that is,a verification result acquired by the terminal device is that the deviceto be ranged is the pairing device that can be paired to the terminaldevice, and a verification result acquired by the device to be ranged isthat the terminal device is the pairing device that can be paired to thedevice to be ranged), the terminal device communicates with the deviceto be ranged to allow the terminal device and the device to be ranged togenerate the same session parameter. It can be understood that thecommunication between the terminal device and the device to be rangedcan be realized by using the ranging software to communicate with thedevice to be ranged via Bluetooth, near field communication (NFC) andother communication means. The communication between the terminal deviceand the device to be ranged can be realized by using the rangingsoftware to communicate with the device to be ranged via CCC, FiRa,ICCOA and other protocols.

In block S102, in the security region, a ranging security parameter isgenerated according to the session parameter.

The ranging software UKS sends the session parameter to the UKS TA inthe security region TEE. Condition and manner for generating the rangingsecurity parameter are preset in the UKS TA, and the UKS TA generatesthe ranging security parameter according to the session parameter inaccordance with the condition and manner. For example, the sessionparameter is a session secret key, and the generated ranging securityparameter is a UWB ranging secret key (URSK).

The generation of the ranging security parameter in the security regionof the processor can avoid relying on other chips other than theprocessor, such as an NFC chip, and flexibility of hardware selectionfor the terminal device with a UWB ranging function is improved

In block S103, the ranging security parameter is sent to the rangingchip via a communication channel between the security region and theranging chip.

Optionally, the UWB chip also has a security region, that is, data inthe security region cannot be read by any program in other regions. Thecommunication channel between the security region of the processor andthe UWB chip can be formed between the security region of the processorand the security region of the UWB chip. The communication channel isbetween the two security regions, and thus communication safety isimproved and a data leakage of communication data transmitted in thecommunication channel is avoided.

In block S104, the ranging chip generates a ranging time parameteraccording to the ranging security parameter, and performs a rangingcommunication with the device to be ranged using the ranging timeparameter to acquire a ranging result.

Condition and manner for generating the ranging time parameter arepreset in the UWB chip, and the UWB chip generates the ranging timeparameter according to the ranging security parameter in accordance withthe condition and manner. For example, the ranging security parameter isthe URSK, and the generated ranging time parameter is a scrambledtimestamp sequence (STS).

It can be understood that the device to be ranged also has a UWB chip.The UWB chip of the device to be ranged may use the session parametergenerated during the initial communication between the terminal deviceand the device to be ranged to generate the ranging security parameter,e.g., URSK. The UWB chip of the device to be ranged may further generatethe ranging time parameter according to the ranging security parameter,for example generate a STS according to the URSK. After both theterminal device and the device to be ranged have generated the sameranging time parameter, the UWB chip of the terminal device and the UWBchip of the device to be ranged can use the ranging time parameter,e.g., the STS for the ranging communication, the UWB chip of theterminal device can acquire the ranging result, i.e., a distance betweenthe terminal device and the device to be ranged through calculation(s)according to the communication result, and the UWB chip of the device tobe ranged can acquire the ranging result, i.e., the distance between theterminal device and the device to be ranged through calculation(s)according to the communication result. The ranging communication betweenthe UWB chip of the terminal device and the UWB chip of the device to beranged may be performed as follows. The terminal device generates afirst UWB packet containing the STS according to data rules, and sendsthe first UWB packet to the device to be ranged. The device to be rangedverifies whether the STS in the first UWB packet is the same as the STSgenerated by the UWB chip of the device to be ranged. If they are thesame, a second UWB packet containing the STS is generated according tothe data rules, and is returned to the terminal device. The terminaldevice verifies whether the STS in the second UWB packet is the same asthe STS generated by the UWB chip of the terminal device. If they arethe same, a third UWB packet containing the STS is generated accordingto the data rules, and is sent to the device to be ranged to completethe ranging communication.

In the present disclosure, by communicating the security region of theprocessor with the ranging chip, the session parameter generated duringthe initial communication between the terminal device and the device tobe ranged is acquired, the ranging security parameter is generatedaccording to the session parameter in the security region, the rangingsecurity parameter is sent to the ranging chip through the communicationchannel between the security region and the ranging chip, and theranging chip generates the ranging time parameter according to theranging security parameter and performs the ranging communication withthe device to be ranged using the ranging time parameter to acquire aranging result. Since the ranging security parameter is generated in thesecurity region of the processor and the communication channel betweenthe security region and the ranging chip is safe, the ranging securityparameter is relatively safe before entering the ranging chip, and dataleakage can be avoided, thus improving the parameter security in theranging process, ensuring the security of application scenarios such aslocation sensing, non-inductive payment, non-inductive entrance andnon-inductive unlock, and avoiding threats to user's information andproperty safeties.

In some embodiments of the present disclosure, before the terminaldevice leaves the factory, the first security parameter can be preset inthe security region of the processor, and the second security parametercan be preset in the security region of the ranging chip, where thefirst security parameter and the second security parameter can be keys.On this basis, the terminal device can establish the communicationchannel between the security region and the ranging chip according tothe first security parameter preset in the security region and thesecond security parameter preset in the ranging chip.

In an embodiment, both the first security parameter and the secondsecurity parameter are a public security parameter, such as a symmetrickey, that is, the first security parameter and the second securityparameter are a common security parameter, i.e., the same securityparameter, such as the same key. In this embodiment, the communicationchannel can be generated between the security region and the rangingchip according to the public security parameter. Specific generatingprocess of the communication channel may be determined according tocommunication protocols such as SCP02 or SCP03.

In another embodiment, the first security parameter includes a publicsecurity parameter and a secret security parameter of the securityregion, and a public security parameter of the ranging chip, and thesecond security parameter includes the public security parameter and asecret security parameter of the ranging chip, and the public securityparameter of the security region. For example, the first securityparameter and the second security parameter can be asymmetric keys, thefirst security parameter includes DEV PK/SK, and UWB. PK (i.e., a publickey and a secret key of the terminal device, and a public key of thedevice to be ranged), and the second security parameter includes DEV PK,and UWB PK/SK (i.e., the public key of the terminal device, and thepublic key and the secret key of the device to be ranged). In thisembodiment, a common security parameter is generated according to thefirst security parameter in the security region. For example, the UKS TAgenerates a common security parameter (referred as scret) according tothe first security parameter by using Diffie-Hellman algorithm. Further,the ranging chip generates said common security parameter scretaccording to the second security parameter. For example, the UWB chipgenerates the common security parameter scret according to the secondsecurity parameter by using Diffie-Hellman algorithm. According to thecommon security parameter scret, the communication channel is generatedbetween the security region and the ranging chip. The specificgenerating process of the communication channel may be determinedaccording to protocols such as SCP11 protocol.

In the above two embodiments, during the generating of the communicationchannel between the security region and the ranging chip, in thesecurity region, the public or common security parameter is preprocessedto generate a temporary security parameter. For example, the UKS TAperforms hashing on preset data of the public or common securityparameter to acquire the temporary security parameter such as one-timesession key. Further, the common security parameter is preprocessed bythe ranging chip to generate said temporary security parameter. Forexample, the UWB chip performs hashing on the preset data of the publicor common security parameter to acquire the temporary security parametersuch as one-time session key. The communication channel between thesecurity region and the ranging chip is generated according to thetemporary security parameter. In the case that the temporary securityparameter is used to generate the communication channel, the public orcommon security parameter is used as a root key. When the communicationchannel needs to be established, a one-time session key that is onlyvalid for this time is generated. In this way, the security of thepublic or common security parameter is improved, the security of thecommunication channel is improved, and thus the security of the rangingsecurity parameter transmitted in the communication channel is improved.Even if the temporary security parameter is lost or leaked during thegeneration of the communication channel, due to the irreversibility ofthe hashing process, the security of the generation of the communicationchannel for the next communication can still be guaranteed.

In a second aspect of embodiments of the present disclosure, a rangingmethod is provided. The ranging method includes operations S301 to S303as shown in FIG. 3 . Such a ranging method is applied in the device tobe ranged as described in the above embodiments of the first aspect.

In block S301, a session parameter generated from an initialcommunication between the device to be ranged and a terminal device isacquired.

In block S302, a ranging security parameter is generated according tothe session parameter.

In block S303, a ranging time parameter is generated according to theranging security parameter, and a ranging communication is performedwith the terminal device using the ranging time parameter to acquire aranging result.

The ranging method in the embodiments of the second aspect includingoperations corresponding to the operations of the ranging method in theembodiments of the first aspect (performed using the terminal device),and the difference is that all operations in these embodiments areperformed in the ranging chip of the device to be ranged, such as theUWB chip.

In a third aspect of embodiments of the present disclosure, a rangingapparatus is provided, which is performed using a terminal device. Theterminal device has a processor and a ranging chip, and the processorhas a security region.

As shown in FIG. 4 , the ranging apparatus includes: a first acquiringmodule 401, a first parameter module 402, a sending module 403, and asecond parameter module 404. The first acquiring module 401 isconfigured to acquire a session parameter generated from an initialcommunication between the terminal device and a device to be ranged. Thefirst parameter module 402 is configured to generate, in the securityregion, a ranging security parameter according to the session parameter.The sending module 403 is configured to send the ranging securityparameter to the ranging chip via a communication channel between thesecurity region and the ranging chip. The second parameter module 404 isconfigured to control the ranging chip to generate a ranging timeparameter according to the ranging security parameter, and perform aranging communication with the device to be ranged using the rangingtime parameter to acquire a ranging result.

In some embodiments, the ranging apparatus includes achannel-establishing module configured to generate the communicationchannel between the security region and the ranging chip according to afirst security parameter preset in the security region and a secondsecurity parameter preset in the ranging chip.

In some embodiments, the first security parameter and the secondsecurity parameter are a common safety parameter, and thechannel-establishing module is configured to generate the communicationchannel between the security region and the ranging chip according tothe common security parameter.

In some embodiments, the first security parameter includes a publicsecurity parameter and a secret security parameter of the securityregion, and a public security parameter of the ranging chip, and thesecond security parameter includes the public security parameter and asecret security parameter of the ranging chip, and the public securityparameter of the security region. The channel-establishing module isconfigured to: generate a common security parameter according to thefirst security parameter in the security region; generate, by theranging chip, the common security parameter according to the secondsecurity parameter; and generate the communication channel between thesecurity region and the ranging chip according to the common securityparameter.

In some embodiments, in case that the channel-establishing module isconfigured to generate the communication channel between the securityregion and the ranging chip according to the common security parameter,the channel-establishing module is further configured to: preprocess thecommon security parameter in the security region to generate a temporarysecurity parameter; preprocess the common security parameter by theranging chip to generate the temporary security parameter; and generatethe communication channel between the security region and the rangingchip according to the temporary security parameter.

In some embodiments, the ranging apparatus further includes acommunication module configured to perform the initial communication bycommunicating with the device to be ranged to allow the terminal deviceand the device to be ranged to verify identities of each other; and inresponse to determining that the identities of the terminal device andthe device to be ranged are verified by each other, communicating withthe device to be ranged to allow the terminal device and the device tobe ranged to generate the same session parameter.

In a fourth aspect of embodiments of the present disclosure, a rangingapparatus is provided, which is performed using a device to be ranged.The ranging apparatus includes a second acquiring module 501, a thirdparameter module 502, and a fourth parameter module 503. The secondacquiring module 501 is configured to acquire a session parametergenerated from an initial communication between the device to be rangedand a terminal device. The third parameter module 502 is configured togenerate a ranging security parameter according to the sessionparameter. The fourth parameter module 503 is configured to generate aranging time parameter according to the ranging security parameter, andperform a ranging communication with the terminal device using theranging time parameter to acquire a ranging result.

Regarding the apparatuses in the above-mentioned embodiments, thespecific manners in which each module performs operations have beendescribed in detail in the embodiments of the methods, and thus will notbe described here again.

In a fifth aspect of embodiments of the present disclosure, anelectronic device is provided. FIG. 6 is a block diagram showing theelectronic device 600. For example, the electronic device 600 may be amobile phone, a computer, a digital broadcasting terminal, a messagingdevice, a game console, a tablet device, a medical device, exercisedevice, a personal digital assistant, and the like.

Referring to FIG. 6 , the device 600 may include one or more of thefollowing components: a processing component 602, a memory 604, a powercomponent 606, a multimedia component 608, an audio component 610, aninput/output (I/O) interface 612, a sensor component 614, and acommunication component 616.

The processing component 602 typically controls overall operations ofthe device 600, such as the operations associated with display,telephone calls, data communications, camera operations, and recordingoperations. The processing component 602 may include one or moreprocessors 620 to execute instructions to perform all or part of thesteps in the above described methods. Moreover, the processing component602 may include one or more modules which facilitate the interactionbetween the processing component 602 and other components. For instance,the processing component 602 may include a multimedia module tofacilitate the interaction between the multimedia component 608 and theprocessing component 602.

The memory 604 is configured to store various types of data to supportthe operation of the device 600. Examples of such data includeinstructions for any applications or methods operated on the device 600,contact data, phonebook data, messages, pictures, video, etc. The memory604 may be implemented using any type of volatile or non-volatile memorydevices, or a combination thereof, such as a static random access memory(SRAM), an electrically erasable programmable read-only memory (EEPROM),an erasable programmable read-only memory (EPROM), a programmableread-only memory (PROM), a read-only memory (ROM), a magnetic memory, aflash memory, a magnetic or optical disk.

The power component 606 provides power to various components of thedevice 600. The power component 606 may include a power managementsystem, one or more power sources, and any other components associatedwith the generation, management, and distribution of power in the device600.

The multimedia component 608 includes a screen providing an outputinterface between the device 600 and the user. In some embodiments, thescreen may include a liquid crystal display (LCD) and a touch panel(TP). If the screen includes the touch panel, the screen may beimplemented as a touch screen to receive input signals from the user.The touch panel includes one or more touch sensors to sense touches,swipes, and gestures on the touch panel. The touch sensors may not onlysense a boundary of a touch or swipe action, but also sense a period oftime and a pressure associated with the touch or swipe action. In someembodiments, the multimedia component 608 includes a front camera and/ora rear camera. The front camera and the rear camera may receive anexternal multimedia datum while the device 600 is in an operation mode,such as a photographing mode or a video mode. Each of the front cameraand the rear camera may be a fixed optical lens system or have focus andoptical zoom capability.

The audio component 610 is configured to output and/or input audiosignals. For example, the audio component 610 includes a microphone(MIC) configured to receive an external audio signal when the device 600is in an operation mode, such as a call mode, a recording mode, and avoice recognition mode. The received audio signal may be further storedin the memory 604 or transmitted via the communication component 616. Insome embodiments, the audio component 610 further includes a speaker tooutput audio signals.

The I/O interface 612 provides an interface between the processingcomponent 602 and peripheral interface modules, such as a keyboard, aclick wheel, buttons, and the like. The buttons may include, but are notlimited to, a home button, a volume button, a starting button, and alocking button.

The sensor component 614 includes one or more sensors to provide statusassessments of various aspects of the device 600. For instance, thesensor component 614 may detect an open/closed status of the device 600,relative positioning of components, e.g., the display and the keypad, ofthe device 600, a change in position of the device 600 or a component ofthe device 600, a presence or absence of user contact with the device600, an orientation or an acceleration/deceleration of the device 600,and a change in temperature of the device 600. The sensor component 614may include a proximity sensor configured to detect the presence ofnearby objects without any physical contact. The sensor component 614may also include a light sensor, such as a CMOS or CCD image sensor, foruse in imaging applications. In some embodiments, the sensor component614 may also include an accelerometer sensor, a gyroscope sensor, amagnetic sensor, a pressure sensor, or a temperature sensor.

The communication component 616 is configured to facilitatecommunication, wired or wirelessly, between the device 600 and otherdevices. The device 600 can access a wireless network based on acommunication standard, such as WiFi, 2G, 3G, 4G, 5G or a combinationthereof. In one embodiment, the communication component 616 receives abroadcast signal or broadcast associated information from an externalbroadcast management system via a broadcast channel. In one embodiment,the communication component 616 further includes a near fieldcommunication (NFC) module to facilitate short-range communications. Forexample, the NFC module may be implemented based on a radio frequencyidentification (RFID) technology, an infrared data association (IrDA)technology, an ultra-wide band (UWB) technology, a Bluetooth (BT)technology, and other technologies.

In some embodiments, the device 600 may be implemented with one or moreapplication specific integrated circuits (ASICs), digital signalprocessors (DSPs), digital signal processing devices (DSPDs),programmable logic devices (PLDs), field programmable gate arrays(FPGAs), controllers, micro-controllers, microprocessors, or otherelectronic components, for performing the above described methods.

In some embodiments, there is also provided a non-transitorycomputer-readable storage medium including instructions, such asincluded in the memory 604, executable by the processor 620 in thedevice 600, for performing the above-described methods. For example, thenon-transitory computer-readable storage medium may be a ROM, a RAM, aCD-ROM, a magnetic tape, a floppy disc, an optical data storage device,and the like.

Other embodiments of the present disclosure will be apparent to thoseskilled in the art from consideration of the specification and practiceof the present disclosure disclosed here. The present disclosure isintended to cover any variations, uses, or adaptations of the presentdisclosure following the general principles thereof and including suchdepartures from the present disclosure as come within known or customarypractice in the art. It is intended that the specification and examplesbe considered as illustrated only, with a true scope and spirit of thepresent disclosure being indicated by the following claims.

It will be appreciated that the present disclosure is not limited to theexact construction that has been described above and illustrated in theaccompanying drawings, and that various modifications and changes can bemade without departing from the scope thereof. It is intended that thescope of the present disclosure only be limited by the appended claims.

What is claimed is:
 1. A ranging method, performed using a terminaldevice comprising a processor and a ranging chip, the processor having asecurity region, and the security region being communicatively connectedto the ranging chip, the ranging method comprising: acquiring a sessionparameter generated from an initial communication between the terminaldevice and a device to be ranged; generating, in the security region, aranging security parameter according to the session parameter; sendingthe ranging security parameter to the ranging chip via a communicationchannel between the security region and the ranging chip; andgenerating, by the ranging chip, a ranging time parameter according tothe ranging security parameter, and performing, by the ranging chip, aranging communication with the device to be ranged using the rangingtime parameter to acquire a ranging result.
 2. The ranging methodaccording to claim 1, further comprising: generating the communicationchannel between the security region and the ranging chip according to afirst security parameter preset in the security region and a secondsecurity parameter preset in the ranging chip.
 3. The ranging methodaccording to claim 2, wherein the first security parameter and thesecond security parameter are a common safety parameter; and generatingthe communication channel between the security region and the rangingchip according to the first security parameter preset in the securityregion and the second security parameter preset in the ranging chipcomprises: generating the communication channel between the securityregion and the ranging chip according to the common security parameters.4. The ranging method according to claim 2, wherein the first securityparameter comprises a first public security parameter and a first secretsecurity parameter of the security region, and a second public securityparameter of the ranging chip, and the second security parametercomprises the second public security parameter and a second secretsecurity parameter of the ranging chip, and the first public securityparameter of the security region; and generating the communicationchannel between the security region and the ranging chip according tothe first security parameter preset in the security region and thesecond security parameter preset in the ranging chip comprises:generating a common security parameter according to the first securityparameter in the security region; generating, by the ranging chip, thecommon security parameter according to the second security parameter;and generating the communication channel between the security region andthe ranging chip according to the common security parameter.
 5. Theranging method according to claim 3, wherein generating thecommunication channel between the security region and the ranging chipaccording to the common security parameter comprises: preprocessing thecommon security parameter in the security region to generate a temporarysecurity parameter; preprocessing the common security parameter by theranging chip to generate the temporary security parameter; andgenerating the communication channel between the security region and theranging chip according to the temporary security parameter.
 6. Theranging method according to claim 4, wherein generating thecommunication channel between the security region and the ranging chipaccording to the common security parameter comprises: preprocessing thecommon security parameter in the security region to generate a temporarysecurity parameter; preprocessing the common security parameter by theranging chip to generate the temporary security parameter; andgenerating the communication channel between the security region and theranging chip according to the temporary security parameter.
 7. Theranging method according to claim 1, further comprising: performing theinitial communication, comprising: communicating with the device to beranged to allow the terminal device and the device to be ranged toverify identities of each other; and in response to determining that theidentities of the terminal device and the device to be ranged areverified by each other, communicating with the device to be ranged toallow the terminal device and the device to be ranged to generate thesame session parameter.
 8. A ranging method, performed using a device tobe ranged, comprising: acquiring a session parameter generated from aninitial communication between the device to be ranged and a terminaldevice; generating a ranging security parameter according to the sessionparameter; and generating a ranging time parameter according to theranging security parameter, and performing a ranging communication withthe terminal device using the ranging time parameter to acquire aranging result.
 9. An electronic device, comprising: a processor; and amemory having stored therein computer instructions executable by theprocessor, wherein in case that the computer instructions are executedby the processor, the processor is configured to implement the rangingmethod, comprising: acquiring a session parameter generated from aninitial communication between a terminal device and a device to beranged; generating, in a security region, a ranging security parameteraccording to the session parameter; sending the ranging securityparameter to a ranging chip via a communication channel between thesecurity region and the ranging chip; and generating a ranging timeparameter according to the ranging security parameter, and performing aranging communication with the device to be ranged using the rangingtime parameter to acquire a ranging result.
 10. The electronic deviceaccording to claim 9, the ranging method further comprises: generatingthe communication channel between the security region and the rangingchip according to a first security parameter preset in the securityregion and a second security parameter preset in the ranging chip. 11.The electronic device according to claim 10, wherein the first securityparameter and the second security parameter are a common safetyparameter; and generating the communication channel between the securityregion and the ranging chip according to the first security parameterpreset in the security region and the second security parameter presetin the ranging chip comprises: generating the communication channelbetween the security region and the ranging chip according to the commonsecurity parameters.
 12. The electronic device according to claim 10,wherein the first security parameter comprises a first public securityparameter and a first secret security parameter of the security region,and a second public security parameter of the ranging chip, and thesecond security parameter comprises the second public security parameterand a second secret security parameter of the ranging chip, and thefirst public security parameter of the security region; and generatingthe communication channel between the security region and the rangingchip according to the first security parameter preset in the securityregion and the second security parameter preset in the ranging chipcomprises: generating a common security parameter according to the firstsecurity parameter in the security region; generating, by the rangingchip, the common security parameter according to the second securityparameter; and generating the communication channel between the securityregion and the ranging chip according to the common security parameter.13. The electronic device according to claim 12, wherein generating thecommunication channel between the security region and the ranging chipaccording to the common security parameter comprises: preprocessing thecommon security parameter in the security region to generate a temporarysecurity parameter; preprocessing the common security parameter by theranging chip to generate the temporary security parameter; andgenerating the communication channel between the security region and theranging chip according to the temporary security parameter.
 14. Theelectronic device according to claim 12, wherein generating thecommunication channel between the security region and the ranging chipaccording to the common security parameter comprises: preprocessing thecommon security parameter in the security region to generate a temporarysecurity parameter; preprocessing the common security parameter by theranging chip to generate the temporary security parameter; andgenerating the communication channel between the security region and theranging chip according to the temporary security parameter.
 15. Theelectronic device according to claim 9, the ranging method furthercomprises: performing the initial communication, comprising:communicating with the device to be ranged to allow the terminal deviceand the device to be ranged to verify identities of each other; and inresponse to determining that the identities of the terminal device andthe device to be ranged are verified by each other, communicating withthe device to be ranged to allow the terminal device and the device tobe ranged to generate the same session parameter.
 16. An electronicdevice, comprising: a processor; and a memory having stored thereincomputer instructions executable by the processor, wherein in case thatthe computer instructions are executed by the processor, the processoris configured to implement the ranging method according to claim
 8. 17.A non-transitory computer-readable storage medium having stored thereina computer program that, when executed by a processor, causes theprocessor to implement the ranging method according to claim
 1. 18. Thenon-transitory computer-readable storage medium according to claim 17,the ranging method further comprises: generating the communicationchannel between the security region and the ranging chip according to afirst security parameter preset in the security region and a secondsecurity parameter preset in the ranging chip.
 19. The non-transitorycomputer-readable storage medium according to claim 18, wherein thefirst security parameter and the second security parameter are a commonsafety parameter; and generating the communication channel between thesecurity region and the ranging chip according to the first securityparameter preset in the security region and the second securityparameter preset in the ranging chip comprises: generating thecommunication channel between the security region and the ranging chipaccording to the common security parameters.
 20. A non-transitorycomputer-readable storage medium having stored therein a computerprogram that, when executed by a processor, causes the processor toimplement the ranging method according to claim 8.